home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiscKit1.7.1 / MiscKit / Headers / misckit / MiscMergeEngine.h < prev    next >
Encoding:
Text File  |  1995-12-19  |  2.6 KB  |  95 lines

  1. //
  2. //    MiscMergeEngine.h -- an engine for merging records into templates
  3. //        Written by Don Yacktman Copyright (c) 1995 by Don Yacktman.
  4. //                Version 1.0.  All rights reserved.
  5. //        This notice may not be removed from this source code.
  6. //
  7. //    This object is included in the MiscKit by permission from the author
  8. //    and its use is governed by the MiscKit license, found in the file
  9. //    "LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
  10. //    for a list of all applicable permissions and restrictions.
  11. //    
  12.  
  13.  
  14. #import <appkit/appkit.h>
  15. #import <misckit/MiscMergeProtocols.h>
  16.  
  17. @class List;
  18. @class MiscMergeCommand;
  19. @class MiscMergeTemplate;
  20. @class MiscString;
  21. @class MiscDictionary;
  22.  
  23. @interface MiscMergeEngine : Object
  24. {
  25.     id template;
  26.     id dictionary;
  27.     MiscMergeEngine *parentMerge;
  28.     MiscDictionary *symbolTable;
  29.     MiscDictionary *variables;
  30.  
  31.     // Used while doing a merge
  32.     BOOL mergeInProgress, abort;
  33.     id outputString;
  34.     BOOL outputOK; // if off, inhibits output; used by conditionals, etc.
  35.     id driver; // the "sender" that started the merge
  36.     BOOL leaveDelimiters; // if on, delimiters are put on unresolved fields
  37. }
  38.  
  39.  
  40. // Creating and setting up an engine
  41. + newWithTemplate:(MiscMergeTemplate *)aTemplate;
  42. - init;
  43.  
  44. // Setting up a merge
  45. - setTemplate:(MiscMergeTemplate *)aTemplate;
  46. - setMergeDictionary:(MiscDictionary *)aDictionary;
  47.  
  48. // Performing a merge
  49. - (MiscString *)merge:sender;
  50. - (MiscString *)mergeWithDictionary:(MiscDictionary *)aDictionary
  51.     sender:sender;
  52.  
  53. // Setting a parent MergeEngine for sub-merges
  54. - setParentMerge:(MiscMergeEngine *)aMergeEngine;
  55. - (MiscMergeEngine *)parentMerge;
  56.  
  57. // Primitives that may be used by MiscMergeCommands to implement
  58. // various functionality.
  59. - abortMerge;
  60. - advanceRecord;
  61. - appendToOutput:(MiscString *)newText;
  62. - (MiscDictionary *)dictionary;
  63.  
  64. @end
  65.  
  66. @interface MiscMergeEngine (Symbols)
  67.  
  68. // Handling the local symbol table
  69. - resetSymbolTable;
  70. - (MiscString *)symbolForKey:(MiscString *)name;
  71. - setSymbol:(MiscString *)name toValue:(MiscString *)value;
  72. - (MiscString *)getField:(MiscString *)fieldName;
  73.  
  74. // Handling merge "variables"
  75. - resetVariables;
  76. - getVariableNamed:(MiscString *)name;
  77. - setVariableNamed:(MiscString *)name to:aValue;
  78. - ifStack; // returns the mergers IF stack, a special variable
  79. - setLeaveDelimiters:(BOOL)aFlag;
  80. - (BOOL)leaveDelimiters;
  81.  
  82. @end
  83.  
  84. @interface MiscMergeEngine (GlobalSymbols)
  85.  
  86. // Handling a global symbol table
  87. + resetGlobalSymbolTable;
  88. + setGlobalSymbol:name toValue:val;
  89. + addDictionaryToGlobalSymbols:(MiscDictionary *)aDictionary;
  90. + addListToGlobalSymbols:(List *)aList;
  91. + (MiscString *)globalSymbolForKey:(MiscString *)name;
  92.  
  93. @end
  94.  
  95.